@section('meta')
    <style>
        body{background-color: #fff;}
        .modal-content{display: unset;}
        .layui-form-label {width: 100px;}
        .layui-input-block {margin-left: 138px;}
        .layui-input, .layui-textarea {width: 86%;}
        .layui-form-select .layui-edge {right: 16%;}
        .layui-form-select dl {min-width: 86%;}
        .new-table {margin: 20px 0;}
        .new-table .selector-title {line-height: 36px;text-align: left;padding-left: 15px;font-size: 16px;font-weight: bold;color: #018164;margin: 20px 0;border-bottom: 1px solid #28b28a;}
    </style>
@endsection
@include('Home.User.Common._meta')
<!----  新增： 薪酬  ---->
<div class="modal-content new-table" id="addNew-content2">
    <form class="layui-form modal-client-info" action="" id="form-user" lay-filter="form-user">
        <div class="modal-func-btns">
            <a href="javascript:;" class="modal-save-btn" onclick="subForm('{{route('salary_add')}}')" title="保存"><i class="icon icon-save"></i></a>
            <a href="javascript:location.replace(location.href);" class="modal-edit-btn" title="重置"><i class="icon icon-edit"></i></a>
        </div>
        @include('Home.User.Common._msg')
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>姓名</label>
            <div class="layui-input-block">
                <select name="assign" lay-search lay-filter="assign">
                        <option value="">请选择员工</option>
                    @foreach($user as $item)
                        <option value="{{$item->id}}">{{$item->username}}</option>
                    @endforeach
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>职级</label>
            <div class="layui-input-block">
                <input type="text" name="rank" lay-verify="required" placeholder="请输入职级" value="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>基础薪资</label>
            <div class="layui-input-block">
                <input type="text" name="salary" lay-verify="required" placeholder="请输入基础薪资" value="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>薪资月份</label>
            <div class="layui-input-block">
                <input type="text" id="month" name="month" lay-verify="required" placeholder="请输入" autocomplete="off" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">KPI结果</label>
            <div class="layui-input-block">
                <input type="text" name="kpi_result" lay-verify="required" placeholder="请输入" value="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">KPI奖金</label>
            <div class="layui-input-block">
                <input type="text" name="kpi_bonus" lay-verify="" placeholder="请输入" value="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">KPI提成(业务)</label>
            <div class="layui-input-block">
                <input type="text" name="kpi_money" lay-verify="" placeholder="请输入" value="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <!--薪资加项明细-->
        <div class="selector-title">薪资加项明细</div>
        <table class="layui-table">
            <thead>
            <tr>
                <th>加班费</th>
                <th>推荐奖金</th>
                <th>节庆礼金</th>
                <th>生日礼金</th>
                <th>房补</th>
                <th>餐补</th>
                <th>话费补贴</th>
                <th>入职机票</th>
                <th>入职签证</th>
                <th>年假折现</th>
                <th>年度机票</th>
                <th>年度医补</th>
                <th>13薪基数</th>
                <th>年度13薪</th>
                <th>其他补发</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td data-label="加班费"><input type="text" name="add_money1" class="layui-input"></td>
                <td data-label="推荐奖金"><input type="text" name="add_money2" class="layui-input"></td>
                <td data-label="节庆礼金"><input type="text" name="add_money3" class="layui-input"></td>
                <td data-label="生日礼金"><input type="text" name="add_money4" class="layui-input"></td>
                <td data-label="房补"><input type="text" name="add_money5" class="layui-input"></td>
                <td data-label="餐补"><input type="text" name="add_money6" class="layui-input"></td>
                <td data-label="话费补贴"><input type="text" name="add_money7" class="layui-input"></td>
                <td data-label="入职机票"><input type="text" name="add_money8" class="layui-input"></td>
                <td data-label="入职签证"><input type="text" name="add_money9" class="layui-input"></td>
                <td data-label="年假折现"><input type="text" name="add_money10" class="layui-input"></td>
                <td data-label="年度机票"><input type="text" name="add_money11" class="layui-input"></td>
                <td data-label="年度医补"><input type="text" name="add_money12" class="layui-input"></td>
                <td data-label="13薪基数"><input type="text" name="add_option1" class="layui-input"></td>
                <td data-label="年度13薪"><input type="text" name="add_money13" class="layui-input"></td>
                <td data-label="其他补发"><input type="text" name="add_money14" class="layui-input"></td>
            </tr>
            </tbody>
        </table>

        <!--薪资扣款明细-->
        <div class="selector-title">薪资扣款明细</div>
        <table class="layui-table">
            <thead>
            <tr>
                <th>总出勤数</th>
                <th>实际出勤</th>
                <th>迟到次数</th>
                <th>迟到扣款</th>
                <th>病假天数</th>
                <th>病假扣款</th>
                <th>事假天数</th>
                <th>事假扣款</th>
                <th>旷工天数</th>
                <th>旷工扣款</th>
                <th>房租扣款</th>
                <th>水电费</th>
                <th>网费</th>
                <th>五险一金</th>
                <th>其他扣款</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td data-label="总出勤数"><input type="text" name="cut_option1" class="layui-input"></td>
                <td data-label="实际出勤"><input type="text" name="cut_option2" class="layui-input"></td>
                <td data-label="迟到次数"><input type="text" name="cut_option3" class="layui-input"></td>
                <td data-label="迟到扣款"><input type="text" name="cut_money1" class="layui-input"></td>
                <td data-label="病假天数"><input type="text" name="cut_option4" class="layui-input"></td>
                <td data-label="病假扣款"><input type="text" name="cut_money2" class="layui-input"></td>
                <td data-label="事假天数"><input type="text" name="cut_option5" class="layui-input"></td>
                <td data-label="事假扣款"><input type="text" name="cut_money3" class="layui-input"></td>
                <td data-label="旷工天数"><input type="text" name="cut_option6" class="layui-input"></td>
                <td data-label="旷工扣款"><input type="text" name="cut_money4" class="layui-input"></td>
                <td data-label="房租扣款"><input type="text" name="cut_money5" class="layui-input"></td>
                <td data-label="水电费"><input type="text" name="cut_money6" class="layui-input"></td>
                <td data-label="网费"><input type="text" name="cut_money7" class="layui-input"></td>
                <td data-label="五险一金"><input type="text" name="cut_money8" class="layui-input"></td>
                <td data-label="其他扣款"><input type="text" name="cut_money9" class="layui-input"></td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
@section('footer')
    <script>
        layui.use(['laydate','form'], function(){
            var laydate = layui.laydate;
            var form = layui.form;

            //执行一个laydate实例
            laydate.render({
                elem: '#month', //指定元素
                type: 'month'
            });

            var user = @JSON($user);
            form.on('select(assign)', function(data){
                $.each(user, function (index, obj) {
                    if (obj.id == data.value) {
                        form.val("form-user", {
                            "rank": obj.rank,
                            "salary": obj.salary,
                        })
                    }
                });
            });


        });
    </script>
@endsection
@include('Home.User.Common._footer')
@include('Home.User.Common._form')